#include "cfiletransfer.h"
#include <QProcess>
#include <QDebug>

CFileTransfer::CFileTransfer()
{

}

int CFileTransfer::getFile(CLoginCfgMgr::TConnectItem& item,QString source,QString dest)
{
    QProcess* p = new QProcess();
    QString c = "pscp.exe -sftp "
                "-pw "+item.m_passwd+" "+
                item.m_user+"@"+item.m_ip+":"+source+ " "+
                dest ;
    qDebug() << c;
    p->execute(c);
    delete p;
    return S_SUCCESS;
}

int CFileTransfer::putFile(CLoginCfgMgr::TConnectItem& item,QString source,QString dest)
{
    QProcess* p = new QProcess();
    QString c = "pscp.exe -sftp "
                "-pw "+item.m_passwd+" "+
                source + " "+
                item.m_user+"@"+item.m_ip+":"+dest;
    qDebug() << c;
    p->execute(c);
    delete p;
    return S_SUCCESS;
}
